<?php 

class FlinkController extends AuthController{
	private $model;
	public function __init(){
		parent::__init();
		$this->model = K('Flink');
	}
	
	public function index(){
		$data = $this->model->getFlinkCate();
		$this->assign('data',$data);
		$this->display();
	}
	public function add(){
		if(IS_POST){
			if(!$this->model->addData()){
				$this->error($this->model->error);
			}
			$this->success("添加成功");
		}
		$this->display();
	}
	public function del(){
		$fid = Q('get.fid', 0, 'intval');
		if(!$this->model->delData($fid)){
			$this->error($this->model->error);
		}
		$this->success("删除成功");
	}
	public function edit(){
		$fid = Q('get.fid', 0, 'intval');
		if(IS_POST){
			if(!$this->model->edit($fid)){
				$this->error($this->model->error);
			}
			$this->success("修改成功",U("index"));
		}
		$data = $this->model->getData($fid);
		$this->assign("data",$data);
		$this->display();
	}
	public function show(){
		$fid = Q('get.fid', 0, 'intval');
		if(!$this->model->show($fid)){
			$this->error($this->model->error);
		}
		go(U('index'));
	}
	public function hid(){
		$fid = Q('get.fid', 0, 'intval');
		if(!$this->model->hid($fid)){
			$this->error($this->model->error);
		}
		go(U('index'));
	}
}
